package cn.edu.zafu.bigdata.x.yaojy;

import java.util.Scanner;

public class ScoreChecker {
    public static void checkScore(int score) throws InvalidScoreException {
        if (score < 0 || score > 100){
            throw new InvalidScoreException("分数必须在0到100之间！");
        }
        System.out.println("分数有效：" + score);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        try{
            System.out.println("请输入分数（0-100）：");
            int score = scanner.nextInt();
            checkScore(score);
        }catch (InvalidScoreException e){
            System.out.println("错误信息：" + e.getMessage());
        }finally {
            scanner.close();
        }
    }
}
